import http from '@/common/js/httpRequest'
//获取标准list
export function getStandardList (params) {
  return http({
    method: 'get',
    url: '/api/base/standard/list',
    params
  })
}
//保存或修改标准
export function saveOrUpdateStandard (data) {
	const url = !data.insideInspectionStandardId ? '/api/base/standard/save' : '/api/base/standard/update'
  return http({
    method: 'post',
    url: url,
    data
  })
}
//修改标准配置货品
export function updateStandardCollocate (data) {
  return http({
    method: 'post',
    url: '/api/base/standard/collocate',
    data
  })
}
//获取此货品的绑定标准数量
export function getPSLinkCount (params) {
  return http({
    method: 'get',
    url: '/api/base/standard/count/product/link',
    params
  })
}
//删除标准
export function deleteStandard (ids) {
  return http({
    method: 'post',
    url: '/api/base/standard/delete',
    data: ids,
    openDefultdata: true
  })
}
//升级标准
export function upgradeStandard (data) {
  return http({
    method: 'post',
    url: '/api/base/standard/upgrade',
    data: data,
    openDefultdata: true
  })
}

//获取标准By货品
export function getStandardByProductId (params) {
  return http({
    method: 'get',
    url: '/api/base/standard/one',
    params
  })
}
//获取标准byid
export function getStandardById (params) {
  return http({
    method: 'get',
    url: '/api/base/standard/one',
    params
  })
}
//标准检验项排序
export function standardSort (data) {
  return http({
    method: 'post',
    url: '/api/base/standard/sort',
    data,
    openDefultdata: true
  })
}

//同步业务数据
export function syncStandard (data) {
  return http({
    method: 'post',
    url: '/api/base/standard/sync',
    data,
    openDefultdata: true
  })
}

//同步业务数据（ids版本）
export function syncStandard4Ids (data) {
  return http({
    method: 'post',
    url: '/api/base/standard/sync4Ids',
    data,
    openDefultdata: true
  })
}

// 立即生效
export function nowTakeEffect (id) {
  return http({
    method: 'post',
    url: `/api/base/standard/te?id=${id}`,
    openDefultdata: true
  })
}
